Skip to content

fix: downgrade transformers due to breaking change in loading from checkpoint.#518

Merged
dushyantbehl merged 1 commit intofoundation-model-stack:mainfrom
dushyantbehl:main
Apr 7, 2025
Merged

fix: downgrade transformers due to breaking change in loading from checkpoint.#518
dushyantbehl merged 1 commit intofoundation-model-stack:mainfrom
dushyantbehl:main

Conversation

@dushyantbehl
Copy link
Copy Markdown
Collaborator

Description of the change

HF recently made a patch available in transformers which looks to be a breaking change for anyone looking to load a model from checkpoint.

                        except RuntimeError as e:
>                           raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
E                           _pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options 
E                               (1) Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
E                               (2) Alternatively, to load with `weights_only=True` please check the recommended steps in the following error message.
E                               WeightsUnpickler error: Unsupported global: GLOBAL numpy.core.multiarray._reconstruct was not an allowed global by default. Please use `torch.serialization.add_safe_globals([_reconstruct])` to allowlist this global if you trust this class/function.
E                           
E                           Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.

.tox/py/lib/python3.12/site-packages/torch/serialization.py:1096: UnpicklingError

This change also has numerous test cases failing in our PRs and would also break anyone loading a model from checkpoint.
Someone noticed this in HuggingFace in their internal testing and have made a patch available . Unfortunately they have not merged the patch yet so we are left with no choice but to limit the transformers version to ensure no one is blocked to use the library till they merge.

Related issue number

How to verify the PR

Was the PR tested

  • I have added >=1 unit test(s) for every new method I have added.
  • I have ensured all unit tests pass

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2025

Thanks for making a pull request! 😃
One of the maintainers will review and advise on the next steps.

@github-actions github-actions Bot added the fix label Apr 7, 2025
Signed-off-by: Dushyant Behl <dushyantbehl@in.ibm.com>
@dushyantbehl dushyantbehl changed the title fix: downgrade hugginface for the time being as they have broken loading from checkpoint. fix: downgrade transformers for the time being as they have broken loading from checkpoint. Apr 7, 2025
@dushyantbehl dushyantbehl changed the title fix: downgrade transformers for the time being as they have broken loading from checkpoint. fix: downgrade transformers due to breaking change in loading from checkpoint. Apr 7, 2025
Copy link
Copy Markdown
Collaborator

@willmj willmj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dushyantbehl dushyantbehl merged commit 37fda79 into foundation-model-stack:main Apr 7, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants